#include<bits/stdc++.h>
using namespace std;
int n,dp[100010][13],l[100010][13];
int main(){
	freopen("summer.in","r",stdin);
	freopen("summer.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)scanf("%d%d%d",&l[i][1],&l[i][2],&l[i][3]);
	dp[n][1]=l[n][1],dp[n][2]=l[n][2],dp[n][3]=l[n][3];
	for(int i=n-1;i>=1;i--)
	{
		dp[i][1]=max(dp[i+1][2],dp[i+1][3])+l[i][1];
		dp[i][2]=max(dp[i+1][1],dp[i+1][3])+l[i][2];
		dp[i][3]=max(dp[i+1][2],dp[i+1][1])+l[i][3];
	}
	cout<<max(dp[1][1],max(dp[1][2],dp[1][3]));
    return 0;
}
